package com.example.bootcurriculumproject.util;

import java.util.Random;

public class NumUtil {
    /*
    * 生成随机单号
    * */
    public static String generateValidateCode(int status){
        String str1 = "qwertyuioplkjhgfdsazxvcbnm";
        Random random = new Random();
        StringBuffer code = new StringBuffer();
        if(status==1){//商品号
            code.append("AR");
        }else if(status==2){//货单号
            code.append("BG");
        }else if(status==3){//订单号/购物车号
            code.append("PK");
        }else {//UID
            code.append("UD");
        }
            int num = new Random().nextInt(999999);
            if(num<100000){
                num+=100000;
            }
            code.append(num);
        for(int i = 1;i<=4;i++){
          int num1 = random.nextInt(26);
          code.append(str1.charAt(num1));
        }
        return code.toString();
    }
    public static int getAddressID(){
        int num = new Random().nextInt(99999999);
        if(num<10000000){
            num+=10000000;
        }
        return num;
    }
}
